<?php

namespace App\Http\Controllers\Front;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;

class Subject extends Controller
{
    public $seo = [
        1 => [
            'title' => '碳银网 光伏征集活动',
            'desc' => '碳银网 光伏征集活动',
            'key_word' => '碳银网 光伏征集活动',
        ],
        2 => [
            'title' => '碳银网 渔船节能技改项目征集',
            'desc' => '碳银网 渔船节能技改项目征集',
            'key_word' => '碳银网 渔船节能技改项目征集',
        ],
    ];

    public $techDeviceTypeList = [
        1 => '节油节电',
        2 => '冷藏',
        3 => '安全',
        4 => '其他',
    ];

    public $servicerTechDeviceList = [
        1 => '光伏板',
        2 => '逆变器',
        3 => '配电箱',
        4 => '其他',
    ];

    public function index(Request $request)
    {
        $id = $request->input('id', 1);
        if (!in_array($id, [1, 2])) {
            $id = 1;
        }
        if ($id == 1) {
            $techDeviceList = $this->servicerTechDeviceList;
        } else if ($id == 2) {
            $techDeviceList = $this->techDeviceTypeList;
        }
        $viewData = [
            'seo' => $this->seo[$id],
            'list' => $techDeviceList,
        ];
        return view('web.subject.' . $id, $viewData);
    }
}
